/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Actor;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.geom.Area;
import java.awt.geom.Rectangle2D;
import javax.vecmath.Point2d;

/**
 *
 * @author Eric-Standard
 */
public class BulletHitMarker extends Actor {
    
    private int drawTime;
    private static final double DEFAULT_ANGLE = 60;
    private static final int DEFAULT_WIDTH = 100;
    private static final int DEFAULT_HEIGHT = DEFAULT_WIDTH;
    private static final int DEFAULT_OFFSETX = -DEFAULT_WIDTH / 2;
    private static final int DEFAULT_OFFSETY = -DEFAULT_HEIGHT / 2;
    
    public BulletHitMarker() {
        super();
        this.collisionDetection = false;
    }
    
    public BulletHitMarker(Point2d p) {
        super(p);
        this.collisionDetection = false;
    }
    
    public void setDrawTime(int time) {
        drawTime = time;
    }
    
    @Override
    public void act(long dt) {
        Point2d posP = world.getPlayer().getPos();
        angle = Math.atan2(posP.y - pos.y, pos.x - posP.x);
        drawTime -= dt;
        if (drawTime <= 0) {
            this.isActive = false;
        }
    }
    
    @Override
    public void draw(Graphics g) {
        g.setColor(Color.RED);
        Point2d posP = world.getPlayer().getPos();
        g.drawArc((int) posP.x + DEFAULT_OFFSETX, (int) posP.y + DEFAULT_OFFSETY,
                DEFAULT_WIDTH, DEFAULT_HEIGHT,
                (int) (angle / Math.PI * 180f - DEFAULT_ANGLE / 2f), (int) DEFAULT_ANGLE);
    }
    
    @Override
    public Rectangle2D getBoundingRectangle() {
        return null;
    }

    @Override
    public Area getArea() {
        return null;
    }
}
